<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
	<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
	<title>考勤记录管理</title>
	<script type="text/javascript" src="../../js/boot.js"></script>
</head>

<body>
	<div class="mini-splitter" style="width: 100%; height: 100%;">
		<div size="240" showCollapseButton="true">
			<div class="mini-fit">
				<ul id="pageTree" class="mini-tree" style="width: 100%;" showTreeIcon="true" allowDrag="true" allowDrop="true" textField="departName"
					idField="departID" resultAsTree="false">
				</ul>
			</div>
		</div>

		<div showCollapseButton="true">
			<fieldset id="fd1" style="width: 97%; margin-bottom: 10px;">
				<legend><span>查询条件</span></legend>
				<div id="queryForm" class="fieldset-body">
					<table class="form-table" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td class="form-label">
								<span>员工姓名：</span>
								<div id="txtUserID" class="mini-autocomplete" style="width:150px;" popupWidth="200" textField="userName" valueField="userID">
									<div property="columns">
										<div header="姓名" field="userName" width="40"></div>
										<div header="编号" field="workNo"></div>
									</div>
								</div>
								<span>日期从：</span>
								<input id="calendarDate_from" name="calendarDate_from" class="mini-datepicker" format="yyyy-MM-dd" showTime="true"
									style="width: 150px" />
								<span>到：</span>
								<input id="calendarDate_to" name="calendarDate_to" class="mini-datepicker" format="yyyy-MM-dd" showTime="true"
									style="width: 150px" />
								<a style="margin: 0 0 0 0;" class="mini-button" iconCls="icon-search" onclick="search()">查询</a>
							</td>
						</tr>
					</table>
				</div>
			</fieldset>

			<div class="mini-fit">
				<div id="datagrid" class="mini-datagrid" style="width:100%;height:100%;" pageSize="20" idField="instID" allowResize="true" multiSelect="true">
					<div property="columns">
						<div field="userID" visible="false"></div>
						<div field="departName" width="60" headerAlign="center">部门名称</div>
						<div field="workNo" width="60" headerAlign="center">工号</div>
						<div field="userName" width="60" headerAlign="center">姓名</div>
						<div field="calendarDate" width="60" headerAlign="center">考勤日期</div>
						<div field="cardRecord" headerAlign="center" width="160">刷卡记录</div>
					</div>
				</div>
			</div>
		</div>
	</div>

</body>

<script type="text/javascript">
	miniInit();

	var txtUserID = mini.get("txtUserID");
	txtUserID.setName("userID");
	txtUserID.set({
		url: http.getUrl("/user/page.do")
	});

	var tree = mini.get("pageTree");
	var queryForm = new mini.Form("#queryForm");
	var datagrid = mini.get("datagrid"); // 表定义列表
	datagrid.set({
		url: http.getUrl("/day/report/page.do")
	});

	// 加载浅蓝色背景和去除滚动条
	$('.mini-splitter').addClass('bg');
	//$('.fieldset-body-body').addClass('bg');

	tree.url = http.getUrl("/sys/depart/list.do");
	tree.load(tree.url);

	var editNode = null; // 当前编辑的节点
	/*********************************************************
	 * 左侧目录树的鼠标点击事件
	 *********************************************************/
	tree.on("nodedblclick", function (e) {
		// debugger
		editNode = e.node;
		tree.loadNode(editNode);
		if (editNode) {
			// search();
		}
	});

	function search() {
		var data = queryForm.getData(true, false);
		var node = tree.getSelectedNode();
		if (node) {
			data["departID"] = node.departID;
			data["departID_link"] = "like";
		}
		data.orderBy = "calendarDate desc";
		datagrid.load(data, null, miniui.showLoadErrorMessageBox);
	}

</script>

</html>